package com.mobilg.dating;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class ChattingDBHelper extends SQLiteOpenHelper  {

	private static final int DATABASE_VERSION = 2;
	private static final String DATABASE_NAME = "chatting";
	private static final String TAG = "DbAdapter";
	
	
	
	private static final String PROFILES_TABLE_NAME = "profiles";
    private static final String PROFILES_ID = "_id";
    private static final String PROFILES_BIRTH_YEAR = "birthyear";
    private static final String PROFILES_BIRTH_MONTH = "birthmonth";
    private static final String PROFILES_BIRTH_DAY = "birthday";
    private static final String PROFILES_FIRSTNAME = "firstname";
    private static final String PROFILES_EMAIL = "email";
    private static final String PROFILES_PASSWORD = "password";
    private static final String PROFILES_LATITUDE = "lat";
    private static final String PROFILES_LONGITUDE = "lon";
    private static final String PROFILES_GENDER = "gender";
    private static final String PROFILES_SEARCHED_GENDER = "searched_gender";
    
	//private static final String PROFILE_TABLE_CREATE =
    private static final String CREATE_TABLE_PROFILE =
                "CREATE TABLE " + PROFILES_TABLE_NAME + " (" +
                PROFILES_ID + " INTEGER primary key autoincrement, " +
                PROFILES_BIRTH_YEAR + " TEXT NOT NULL, " +
                PROFILES_BIRTH_MONTH + " TEXT NOT NULL, " +
                PROFILES_BIRTH_DAY + " TEXT NOT NULL, " +
                PROFILES_FIRSTNAME + " TEXT NOT NULL, "+
                PROFILES_EMAIL + " TEXT NOT NULL, "+
                PROFILES_PASSWORD + " TEXT NOT NULL, "+
                PROFILES_LATITUDE + " DOUBLE NOT NULL, "+
                PROFILES_LONGITUDE + " DOUBLE NOT NULL, "+
                PROFILES_GENDER + " TEXT NOT NULL, "+
                PROFILES_SEARCHED_GENDER + " TEXT NOT NULL"+
                ");";
	
	public ChattingDBHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);		
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_TABLE_PROFILE);		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	    Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
                + newVersion + ", which will destroy all old data");
        db.execSQL("DROP TABLE IF EXISTS notes");
        onCreate(db);
	}

}
